/*
 * @(#)MaintSysUdfFieldValueForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.bean.SysUdfFieldValue;

/**
  MaintSysUdfFieldValueForm.java

  This class is the for web form purpose.

  @author      Zoe Shum
  @company     DCIVision Limited
  @creation date   14/07/2004
  @version     $Revision: 1.5 $
*/

public class MaintSysUdfFieldValueForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.5 $";

  private String formName;
  private String userDefinedFieldDetailID = null;
  private String fieldValue = null;
  private String defaultValue = null;
  private String UDFFieldID = null;

  private List fieldList=null;
  private String parentForm=null;
  
  public MaintSysUdfFieldValueForm() {
    super();
  }

  public String getFormName() {
    return (this.formName);
  }

  public void setFormName(String formName) {
    this.formName = formName;
  }

  public String getUserDefinedFieldDetailID() {
    return(this.userDefinedFieldDetailID);
  }

  public void setUserDefinedFieldDetailID(String userDefinedFieldDetailID) {
    this.userDefinedFieldDetailID = userDefinedFieldDetailID;
  }

  public String getFieldValue() {
    return(this.fieldValue);
  }

  public void setFieldValue(String fieldValue) {
    this.fieldValue = fieldValue;
  }

  public String getDefaultValue() {
    return(this.defaultValue);
  }

  public void setDefaultValue(String defaultValue) {
    this.defaultValue = defaultValue;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void setFieldList(List fieldList) {
    this.fieldList = fieldList;
  }

  public List getFieldList() {
    return (this.fieldList);
  }
  
  public void setParentForm(String parentForm){
    this.parentForm = parentForm; 
  }
  
  public String getParentForm(){
    return this.parentForm;
  }
  
  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setUserDefinedFieldDetailID(null);
    this.setFieldValue(null);
    this.setDefaultValue(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
    this.setUDFFieldID(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    SysUdfFieldValue tmpSysUdfFieldValue = new SysUdfFieldValue();
    tmpSysUdfFieldValue.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpSysUdfFieldValue.setUserDefinedFieldDetailID(TextUtility.parseIntegerObj(this.getUserDefinedFieldDetailID()));
    tmpSysUdfFieldValue.setFieldValue(this.getFieldValue());
    tmpSysUdfFieldValue.setDefaultValue(this.getDefaultValue());
    tmpSysUdfFieldValue.setParentForm(this.getParentForm());
    tmpSysUdfFieldValue.setRecordStatus(this.getRecordStatus());
    tmpSysUdfFieldValue.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpSysUdfFieldValue.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpSysUdfFieldValue.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpSysUdfFieldValue.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpSysUdfFieldValue.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpSysUdfFieldValue;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    SysUdfFieldValue tmpSysUdfFieldValue = (SysUdfFieldValue)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpSysUdfFieldValue.getID()));
    this.setUserDefinedFieldDetailID(TextUtility.formatIntegerObj(tmpSysUdfFieldValue.getUserDefinedFieldDetailID()));
    this.setFieldValue(tmpSysUdfFieldValue.getFieldValue());
    this.setDefaultValue(tmpSysUdfFieldValue.getDefaultValue());
    this.setParentForm(tmpSysUdfFieldValue.getParentForm());
    this.setRecordStatus(tmpSysUdfFieldValue.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpSysUdfFieldValue.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpSysUdfFieldValue.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpSysUdfFieldValue.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpSysUdfFieldValue.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpSysUdfFieldValue.getUpdateDate()));
  }

	public String getUDFFieldID() {
		return UDFFieldID;
	}

	public void setUDFFieldID(String fieldID) {
		UDFFieldID = fieldID;
	}
}
